﻿using System;
using System.ComponentModel;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Windows.Forms;

namespace oled
{
    public class WinForm_Contrl
    {

        public static void Windows_Set_Center(
            Form form, int form_x, int fornm_y,
            PictureBox panel, int panel_x, int panel_y)
        {
            Center_Get(form, out int X, out int Y);
            Center_Set(form, X, Y);
            Size_Set(panel, panel_x, panel_y);
            Size_Set(form,  form_x, fornm_y);

        }
        public static void Center_Get(Form winform, out int X, out int Y)
        {
            X = winform.Location.X + winform.Width / 2;
            Y = winform.Location.Y + winform.Height / 2;
        }

        public static void Center_Set(Form winform, int X, int Y)
        {
            X = X - winform.Width / 2;
            Y = Y - winform.Height / 2;
            winform.Location = new Point(X, Y);
        }

        public static void Size_Set(PictureBox panel, int Height, int Width)
        {
            panel.Height = Height;
            panel.Width = Width;
        }
        public static void Size_Set(Form winform, int Height, int Width)
        {
            winform.Height = Height;
            winform.Width = Width;
        }
    }
}
